const express = require('express')
const { createProxyMiddleware } = require('http-proxy-middleware')
const app = express()
const PORT = 3000

// serve fo tatic files
app.use(express.static('demos'))

// '/api' proxy
app.use('/api-xxx', createProxyMiddleware({
    target: 'http://xxxxxx', // token service host
    changeOrigin: true,
}));


app.listen(PORT, (error) => {
    if (error) console.log(error)
    console.log(`You service is running at http://localhost:${PORT}`)
})
